{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Valid Boomerang"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #geometry #array #math"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #几何 #数组 #数学"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: isBoomerang"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #有效的回旋镖"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给定一个数组<meta charset=\"UTF-8\" />&nbsp;<code>points</code>&nbsp;，其中<meta charset=\"UTF-8\" />&nbsp;<code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>&nbsp;表示 <strong>X-Y</strong> 平面上的一个点，<em>如果这些点构成一个&nbsp;</em><strong>回旋镖</strong>&nbsp;则返回&nbsp;<code>true</code>&nbsp;。</p>\n",
    "\n",
    "<p><strong>回旋镖</strong>&nbsp;定义为一组三个点，这些点&nbsp;<strong>各不相同</strong>&nbsp;且&nbsp;<strong>不在一条直线上</strong>&nbsp;。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>points = [[1,1],[2,3],[3,2]]\n",
    "<strong>输出：</strong>true\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<strong>输入：</strong>points = [[1,1],[2,2],[3,3]]\n",
    "<strong>输出：</strong>false</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "<meta charset=\"UTF-8\" />\n",
    "\n",
    "<ul>\n",
    "\t<li><code>points.length == 3</code></li>\n",
    "\t<li><code>points[i].length == 2</code></li>\n",
    "\t<li><code>0 &lt;= x<sub>i</sub>, y<sub>i</sub>&nbsp;&lt;= 100</code></li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [valid-boomerang](https://leetcode.cn/problems/valid-boomerang/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [valid-boomerang](https://leetcode.cn/problems/valid-boomerang/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['[[1,1],[2,3],[3,2]]', '[[1,1],[2,2],[3,3]]']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[1][0] - points[0][0]) * (points[2][1] - points[0][1]) != (points[2][0] - points[0][0]) * (points[1][1] - points[0][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        x1, y1 = (points[1][1] - points[0][1]), (points[1][0] - points[0][0])                \n",
    "        x2, y2 = (points[2][1] - points[0][1]), (points[2][0] - points[0][0])\n",
    "\n",
    "        if x1 * y2 == y1 * x2:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        space = points[0][0]*(points[1][1]-points[2][1])\n",
    "        space+=points[1][0]*(points[2][1]-points[0][1])\n",
    "        space+=points[2][0]*(points[0][1]-points[1][1])\n",
    "        if space!=0:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if points[0]==points[1] or points[0]==points[2] or points[1]==points[2]:\n",
    "            return False\n",
    "        x1,y1 = points[0]\n",
    "        x2,y2 = points[1]\n",
    "        x3,y3 = points[2]\n",
    "        k1 = (y2-y1)/(x2-x1) if x2-x1!=0 else None\n",
    "        k2 = (y3-y1)/(x3-x1) if x3-x1!=0 else None\n",
    "        k3 = (y2-y3)/(x2-x3) if x2-x3!=0 else None\n",
    "        if k1==k2==k3 or y1==y2==y3:\n",
    "            return False\n",
    "        return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[0][0]-points[1][0])*(points[2][1]-points[0][1]) != (points[2][0]-points[0][0])*(points[0][1]-points[1][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        a = [points[1][0]-points[0][0],points[1][1]-points[0][1]]\n",
    "        b = [points[2][0]-points[0][0],points[2][1]-points[0][1]]\n",
    "        return a[0] * b[1] - a[1] * b[0] != 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\r\n",
    "    def isBoomerang(self, points: list[list[int]]) -> bool:\r\n",
    "        v1 = [points[0][0] - points[1][0], points[0][1] - points[1][1]]\r\n",
    "        v2 = [points[0][0] - points[2][0], points[0][1] - points[2][1]]\r\n",
    "        return v1[0]*v2[1] != v1[1]*v2[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if points[0][0] == points[1][0] == points[2][0]:\n",
    "            return False\n",
    "        elif points[0][0] != points[1][0] and points[0][0] != points[2][0] and points[1][0] != points[2][0]:\n",
    "            return (points[2][1] - points[1][1])/(points[2][0] - points[1][0]) != (points[0][1] - points[1][1])/(points[0][0] - points[1][0])\n",
    "        elif points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[1][0] - points[0][0]) * (points[2][1] - points[0][1]) != (points[2][0] - points[0][0]) *(points[1][1] - points[0][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v01 = [points[1][0] - points[0][0], points[1][1] - points[0][1]]\n",
    "        v02 = [points[2][0] - points[0][0], points[2][1] - points[0][1]]\n",
    "        \n",
    "        det = (v01[0] * v02[1]) - (v01[1] * v02[0])\n",
    "\n",
    "        if det == 0:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        x1, y1, x2, y2, x3, y3 = points[0][0], points[0][1], points[1][0], points[1][1], points[2][0], points[2][1]\n",
    "        if (x1 == x2 and y1 == y2) or (x3 == x2 and y3 == y2) or (x1 == x3 and y1 == y3):\n",
    "            return False\n",
    "        # 为了避免除数为零，用乘法判断斜率是否一致\n",
    "        return (x2 - x1) * (y3 - y2) != (y2 - y1) * (x3 - x2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return not (points[0][0]-points[1][0])*(points[1][1]-points[2][1])==(points[1][0]-points[2][0])*(points[0][1]-points[1][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if points[0] == points[1] or points[0] == points[2] or points[2] == points[1]:\n",
    "            return False\n",
    "        def __k(p1, p2):\n",
    "            if p1[0] != p2[0]:\n",
    "                return (p1[1] - p2[1]) / (p1[0] - p2[0])\n",
    "            else:\n",
    "                return float(\"inf\")\n",
    "        p1 = points[0]\n",
    "        p2 = points[1]\n",
    "        p3 = points[2]\n",
    "        if __k(p1, p2) == __k(p2, p3):\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        x1=points[0][0]-points[1][0]\n",
    "        y1=points[0][1]-points[1][1]\n",
    "        x2=points[2][0]-points[1][0]\n",
    "        y2=points[2][1]-points[1][1]\n",
    "        return x1*y2-x2*y1!=0    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "                          \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        c,d = points[1][1] - points[0][1], points[2][1] - points[1][1]\n",
    "        \n",
    "        if (a == 0 and c == 0) or (b == 0 and d== 0):\n",
    "            return False\n",
    "        \n",
    "        \n",
    "        if a and b:\n",
    "            if c / a == d / b:\n",
    "               return False\n",
    "               \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[1][0] - points[0][0]) * (points[2][1] - points[0][1]) != (points[2][0] - points[0][0]) * (points[1][1] - points[0][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "                          \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        c,d = points[1][1] - points[0][1], points[2][1] - points[1][1]\n",
    "        \n",
    "        \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "        \n",
    "        if (a == 0 and c == 0) or (b == 0 and d== 0):\n",
    "            return False\n",
    "        \n",
    "        \n",
    "        if a and b:\n",
    "            if c / a == d / b:\n",
    "               return False\n",
    "               \n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "                          \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        c,d = points[1][1] - points[0][1], points[2][1] - points[1][1]\n",
    "        \n",
    "        if (a == 0 and c == 0) or (b == 0 and d== 0):\n",
    "            return False\n",
    "        \n",
    "        \n",
    "        if a and b:\n",
    "            if c / a == d / b:\n",
    "               return False\n",
    "               \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if len(set(tuple(i) for i in points)) < 3:return False\n",
    "        if points[1][0] - points[0][0] == 0 or points[2][0] - points[1][0] == 0:\n",
    "            if points[1][0] - points[0][0] == points[2][0] - points[1][0]:\n",
    "                return False\n",
    "            else:\n",
    "                return True\n",
    "        if (points[1][1] - points[0][1])/(points[1][0] - points[0][0]) == (points[2][1] - points[1][1])/(points[2][0] - points[1][0]):\n",
    "            return False\n",
    "        return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        # print(line1_x, line1_y, line2_x, line2_y)\n",
    "\n",
    "        return (points[1][1] - points[0][1]) * (points[2][0] - points[0][0]) != (points[2][1] - points[0][1]) * (points[1][0] - points[0][0]) \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[0][0] - points[1][0]) * (points[0][1] - points[2][1]) != (points[0][0] - points[2][0]) * (points[0][1] - points[1][1])\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        #两点确定一条直线y =kx + b，第三个点不在线上即可\n",
    "        (x1, y1), (x2, y2), (x3, y3) = points\n",
    "\n",
    "\n",
    "        return (y2 - y1) * (x3 - x2) != (y3 - y2) * (x2 - x1) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        h = []\n",
    "        for i in points:\n",
    "            if i in h:\n",
    "                return False\n",
    "            else:\n",
    "                h.append(i)\n",
    "        return (points[0][0] - points[1][0]) * (points[1][1] - points[2][1]) != (points[1][0] - points[2][0]) * (points[0][1] - points[1][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "       \n",
    "        \n",
    "       \n",
    "        for i in range(len(points)):\n",
    "            if points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "                return False\n",
    "                \n",
    "                \n",
    "      \n",
    "        points = sorted(points, key=lambda x: x[0])\n",
    "        \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        if a and b:\n",
    "            if (points[1][1] - points[0][1]) / a == (points[2][1] - points[1][1]) / b:\n",
    "               return False\n",
    "               \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "       \n",
    "        \n",
    "       \n",
    "        for i in range(len(points)):\n",
    "            if points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "                return False\n",
    "                \n",
    "                \n",
    "      \n",
    "        points = sorted(points, key=lambda x: x[0])\n",
    "        \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        if a and b:\n",
    "            if (points[1][1] - points[0][1]) / a == (points[2][1] - points[1][1]) / b:\n",
    "               return False\n",
    "               \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        # 重复点\n",
    "        points = sorted(points, key=lambda x: (x[0], x[1]))\n",
    "\n",
    "        x = []\n",
    "        y = []\n",
    "\n",
    "        for l, r in points:\n",
    "            # 重复点判断\n",
    "            if x and l == x[-1] and r == y[-1]:\n",
    "                return False\n",
    "            x.append(l)\n",
    "            y.append(r)\n",
    "        # 同一坐标轴、相同斜率\n",
    "        if (len(set(x)) == 1 or len(set(y)) == 1 or (\n",
    "                x[2] != x[1] and x[1] != x[0] and (y[2] - y[1]) / (x[2] - x[1]) == (y[1] - y[0]) / (x[1] - x[0]))):\n",
    "            return False\n",
    "\n",
    "        return True\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        points = [points[i] for i in range(len(points)) if points[i] not in points[i+1:]]\n",
    "        k = [(points[i+1][1]-points[i][1])/(points[i+1][0]-points[i][0]) if (points[i+1][0]-points[i][0]) != 0 else None for i in range(len(points)-1)]\n",
    "        return len(k) > 1 and k[0] != k[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "       \n",
    "        \n",
    "       \n",
    "        for i in range(len(points)):\n",
    "            if points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "                return False\n",
    "                \n",
    "                \n",
    "      \n",
    "        #points = sorted(points, key=lambda x: x[0])\n",
    "        \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        if a and b:\n",
    "            if (points[1][1] - points[0][1]) / a == (points[2][1] - points[1][1]) / b:\n",
    "               return False\n",
    "               \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "\n",
    "        if v1[0] == 0 and v1[1] == 0:\n",
    "            return False\n",
    "        if v2[0] == 0 and v2[1] == 0:\n",
    "            return False\n",
    "\n",
    "        v1v2 = v1[0]*v2[0] + v1[1]*v2[1]\n",
    "        v1_ = v1[0] * v1[0] + v1[1] * v1[1]\n",
    "        v2_ = v2[0] * v2[0] + v2[1] * v2[1]\n",
    "        return (v1v2*v1v2)/(v1_*v2_) != 1\n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        p1, p2, p3 = points\n",
    "        if p1 == p2 or p2 == p3 or p1 == p3:\n",
    "            return False\n",
    "        return (p2[0]-p1[0])*(p3[1]-p1[1]) != (p3[0]-p1[0])*(p2[1]-p1[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        # 计算向量积\n",
    "        vector_product = (points[1][1] - points[0][1]) * (points[2][0] - points[1][0]) - (points[2][1] - points[1][1]) * (points[1][0] - points[0][0])\n",
    "\n",
    "        # 如果向量积为零，说明三点共线，返回False\n",
    "        if vector_product == 0:\n",
    "            return False\n",
    "        else:\n",
    "            return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        x1 = points[1][0]-points[0][0]\n",
    "        y1 = points[1][1]-points[0][1]\n",
    "        x2 = points[2][0]-points[1][0]\n",
    "        y2 = points[2][1]-points[1][1]\n",
    "\n",
    "        def check(x, y):\n",
    "            if x**2+y**2 != 0:\n",
    "                return True\n",
    "            return False\n",
    "\n",
    "        if check(x1, y1) and check(x2, y2) and x1*y2 - x2*y1 != 0:\n",
    "            return True\n",
    "        return False\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if len(points) != len(set([(x, y) for x, y in points])):\n",
    "            return False\n",
    "        x1, y1 = points[0]\n",
    "        x2, y2 = points[1]\n",
    "        x3, y3 = points[2]\n",
    "        x, y = x2 - x1, y2 - y1\n",
    "        u, v = x3 - x1, y3 - y1\n",
    "        if x * v - y * u == 0:\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        '''\n",
    "        回旋镖，三个点不在一条直线上，只要有拐点，那就是回旋镖\\U0001fa83，这样的。\n",
    "        所以看比率，不相等就是\n",
    " \n",
    "        '''\n",
    "        (x1,y1),(x2,y2),(x3,y3)=points\n",
    "        if (x1-x2)*(y2-y3)!=(y1-y2)*(x2-x3):\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        x1, y1 = points[0]\n",
    "        x2, y2 = points[1]\n",
    "        x3, y3 = points[2]\n",
    "\n",
    "        #d = (y2 - y1) // (x2 - x1) != (y3 - y2) // (x3 - x2)\n",
    "\n",
    "        return (y2 - y1) * (x3 - x2) != (y3 - y2) * (x2 - x1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        points =  sorted(points)\n",
    "        dy = points[1][1] - points[0][1]\n",
    "        dx = points[1][0] - points[0][0]\n",
    "        print(dx , dy) \n",
    "        if dy == 0 and dx == 0 : return False \n",
    "        if dx == 0 : return points[2][0] != points[0][0]\n",
    "        k = dy / dx \n",
    "        b = points[1][1] - k * points[1][0]  # -1 \n",
    "        print(k * points[2][0] + b) \n",
    "        return abs(points[2][1] - (k * points[2][0] + b)) > 1e-6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        (x1,y1),(x2,y2),(x3,y3)=points\n",
    "        return (y2-y1)*(x3-x2)!=(x2-x1)*(y3-y2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        (x1, y1), (x2, y2), (x3, y3) = points\n",
    "        if (x1, y1) == (x2, y2) or (x1, y1) == (x3, y3) or (x2, y2) == (x3, y3):\n",
    "            return False\n",
    "        return (x3 - x1) * (y2 - y1) != (x2 - x1) * (y3 - y1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if points[0] == points[1] or points[0] == points[2] or points[2] == points[1]:\n",
    "            return False\n",
    "        if (points[0][1] == points[1][1] and points[0][1] != points[2][1]) or (points[0][1] == points[2][1] and points[0][1] != points[1][1]) or (points[2][1] == points[1][1] and points[0][1] != points[2][1]):\n",
    "            return True\n",
    "        if points[0][1] == points[1][1] == points[2][1] or points[0][0] == points[1][0] == points[2][0]:\n",
    "            return False\n",
    "        if (points[0][0]-points[1][0])/(points[0][1]-points[1][1]) == (points[0][0]-points[2][0])/(points[0][1]-points[2][1]):\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "         return (points[1][0] - points[0][0]) * (points[2][1] - points[0][1]) != (points[2][0] - points[0][0]) * (points[1][1] - points[0][1])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[1][1]-points[0][1])*(points[2][0]-points[0][0]) != (points[1][0]-points[0][0])*(points[2][1]-points[0][1])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "                          \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        c,d = points[1][1] - points[0][1], points[2][1] - points[1][1]\n",
    "        \n",
    "        \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "        \n",
    "        if (a == 0 and c == 0) or (b == 0 and d== 0):\n",
    "            return False\n",
    "        \n",
    "        \n",
    "        if a and b:\n",
    "            if c / a == d / b:\n",
    "               return False\n",
    "               \n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        p1, p2, p3 = points\n",
    "        return (p2[0] - p1[0]) * (p3[1] - p1[1]) != (p2[1] - p1[1]) * (p3[0] - p1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "       \n",
    "        \n",
    "       \n",
    "        for i in range(len(points)):\n",
    "            if points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "                return False\n",
    "                \n",
    "                \n",
    "      \n",
    "        points = sorted(points, key=lambda x: x[0])\n",
    "        \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        if a and b:\n",
    "            if (points[1][1] - points[0][1]) / a == (points[2][1] - points[1][1]) / b:\n",
    "               return False\n",
    "               \n",
    "        m1 = list(set(map(lambda x: x[0], points)))      \n",
    "        m2 = list(set(map(lambda x: x[1], points)))\n",
    "        \n",
    "        if len(m1) == 1 or len(m2) == 1:\n",
    "            return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        # if len(set((x, y) for x, y in points)) != 3:\n",
    "        #     return False \n",
    "        # if points[0][0] == points[1][0] == points[2][0]:\n",
    "        #     return False \n",
    "        # if (points[0][0] == points[1][0]) or (points[0][0] == points[2][0]):\n",
    "        #     return True \n",
    "        # if (points[1][1]-points[0][1]) / (points[1][0]-points[0][0]) == (points[2][1]-points[0][1]) / (points[2][0]-points[0][0]):\n",
    "        #     return False \n",
    "        # return True\n",
    "\n",
    "        # ------------------------------------\n",
    "        return (points[1][1]-points[0][1]) * (points[2][0]-points[0][0]) != (points[2][1]-points[0][1]) * (points[1][0]-points[0][0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[1][0] - points[0][0]) * (points[2][1] - points[0][1]) != (points[2][0] - points[0][0]) * (points[1][1] - points[0][1])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if points[0][0] == points[1][0] and points[0][1] == points[1][1]:\n",
    "            return False\n",
    "        elif points[2][0] == points[1][0] and points[2][1] == points[1][1]:\n",
    "            return False\n",
    "        elif points[2][0] == points[0][0] and points[2][1] == points[0][1]:\n",
    "            return False\n",
    "        k1 = k2 = pow(2, 31) \n",
    "        if points[0][0] != points[1][0]:\n",
    "            k1 = (points[1][1] - points[0][1]) / (points[1][0] - points[0][0])\n",
    "        if points[2][0] != points[1][0]:\n",
    "            k2 = (points[1][1] - points[2][1]) / (points[1][0] - points[2][0])\n",
    "        return k1 != k2\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "       \n",
    "        \n",
    "       \n",
    "        for i in range(len(points)):\n",
    "            if points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "                return False\n",
    "                \n",
    "                \n",
    "      \n",
    "        points = sorted(points, key=lambda x: x[0])\n",
    "        \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        if a and b:\n",
    "            if (points[1][1] - points[0][1]) / a == (points[2][1] - points[1][1]) / b:\n",
    "               return False\n",
    "               \n",
    "        m1 = list(set(map(lambda x: x[0], points)))      \n",
    "        m2 = list(set(map(lambda x: x[1], points)))\n",
    "        \n",
    "        if len(m1) == 1 or len(m2) == 1:\n",
    "            return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        x1, y1 = points[0][0], points[0][1]\n",
    "        x2, y2 = points[1][0], points[1][1]\n",
    "        x3, y3 = points[2][0], points[2][1]\n",
    "        return x1 * y2 + x2 * y3 + x3 * y1 != x1 * y3 + x2 * y1 + x3 * y2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[0][0] - points[1][0]) * (points[2][1] - points[1][1]) != (points[2][0] - points[1][0]) * (points[0][1] - points[1][1] )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        return (points[1][0]-points[0][0])*(points[2][1]-points[0][1])!=(points[2][0]-points[0][0])*(points[1][1]-points[0][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        \n",
    "       return False if (points[2][1] - points[0][1]) * (points[1][0] - points[0][0]) == (points[1][1] - points[0][1]) *(points[2][0] - points[0][0]) else True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        ax=points[1][0]-points[0][0]\n",
    "        ay=points[1][1]-points[0][1]\n",
    "        bx=points[2][0]-points[1][0]\n",
    "        by=points[2][1]-points[1][1]\n",
    "        if(ax*by==ay*bx):\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        #points = sorted(points, key=lambda x :x[0])\n",
    "        if (points[1][1] - points[0][1])*(points[2][0] - points[1][0]) == (points[2][1] - points[1][1])*(points[1][0] - points[0][0]):\n",
    "            return False\n",
    "        return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "       \n",
    "        \n",
    "       \n",
    "        for i in range(len(points)):\n",
    "            if points[0] == points[1] or points[1] == points[2] or points[0] == points[2]:\n",
    "                return False\n",
    "                \n",
    "                \n",
    "      \n",
    "        #points = sorted(points, key=lambda x: x[0])\n",
    "        \n",
    "        \n",
    "        a,b = points[1][0] - points[0][0], points[2][0] - points[1][0]\n",
    "        if a and b:\n",
    "            if (points[1][1] - points[0][1]) / a == (points[2][1] - points[1][1]) / b:\n",
    "               return False\n",
    "               \n",
    "        if a == 0 and b == 0:\n",
    "           return False\n",
    "        \n",
    "       \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        #points = sorted(points, key=lambda x :x[0])\n",
    "        if (points[1][1] - points[0][1])*(points[2][0] - points[1][0]) == (points[2][1] - points[1][1])*(points[1][0] - points[0][0]):\n",
    "            return False\n",
    "        return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        v1 = (points[1][0] - points[0][0], points[1][1] - points[0][1])\n",
    "        v2 = (points[2][0] - points[0][0], points[2][1] - points[0][1])\n",
    "        return v1[0] * v2[1] - v1[1] * v2[0] != 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def isBoomerang(self, points: List[List[int]]) -> bool:\n",
    "        if points[0] == points[1] or points[0]==points[2] or points[1] == points[2]:\n",
    "            return False\n",
    "        a, b, c, d, e, f = points[0][0], points[0][1], points[1][0], points[1][1], points[2][0], points[2][1]\n",
    "        if b == d == f:\n",
    "            return False\n",
    "        if a == c == e:\n",
    "            return False\n",
    "        if a == c != e or a == e != c or c == e != a :\n",
    "            return True\n",
    "        xielv1, xielv2, xielv3 = (d-b)/(c-a), (f-b) / (e-a), (d-f)/(c-e)\n",
    "        print(\"xielv1={}, xielv2={}, xielv3={}\".format(xielv1, xielv2, xielv3))\n",
    "        return True if xielv1 != xielv2 and xielv1 != xielv3 else False"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
